//
//  ViewController.swift
//  ColorPickerLibDemo
//
//  Created by youmy on 2021/2/23.
//

import UIKit
import ColorPickerLib

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let view1 = UIView(frame: CGRect(x: 20, y: 60, width: 100, height: 100))
        view.addSubview(view1)

        let colorPicker = ColorPicker(frame: CGRect(x: 20, y: 140, width: view.bounds.width - 40, height: view.bounds.width - 40))
        colorPicker.backgroundColor = .orange
        view.addSubview(colorPicker)

        colorPicker.selectColor = { color in
            if let color = color {
                view1.backgroundColor = color
            }
        }
    }
}


